﻿//-----------------------------------------------------------------------
// <copyright file="Actions.cs" company="tuliprules.org">
//     Copyright (c) 2011 tuplelister, tuliprules.org.
// </copyright>
// <summary>This is the Actions class.</summary>
//-----------------------------------------------------------------------

namespace Tulip.Rules.Models.Rif.Prd
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Xml.Serialization;

    /// <summary>
    /// Represents a list of actions.
    /// </summary>
    [Serializable]
    [DesignerCategory(@"code")]
    [XmlType(AnonymousType = true, Namespace = "http://www.w3.org/2007/rif#")]
    [XmlRoot(Namespace = "http://www.w3.org/2007/rif#", IsNullable = false)]
    public class Actions : IRifPrdElement
    {
        /// <summary>
        /// A collection of action fields.
        /// </summary>
        [EditorBrowsable(EditorBrowsableState.Never)]
        private List<object> actionsField;

        /// <summary>
        /// The ordered field.
        /// </summary>
        [EditorBrowsable(EditorBrowsableState.Never)]
        private string orderedField;

        /// <summary>
        /// Initializes a new instance of the <see cref="Actions"/> class. 
        /// </summary>
        public Actions()
        {
            this.actionsField = new List<object>();
            this.orderedField = "yes";
        }

        /// <summary>
        /// Gets or sets a list of actions.
        /// </summary>
        [XmlElement("Assert", typeof(Assert), Order = 0)]
        [XmlElement("Retract", typeof(Retract), Order = 0)]
        [XmlElement("Modify", typeof(Modify), Order = 0)]
        [XmlElement("Execute", typeof(Execute), Order = 0)]
        public List<object> ActionList
        {
            get
            {
                return this.actionsField;
            }

            set
            {
                this.actionsField = value;
            }
        }

        /// <summary>
        /// Gets or sets a flag indicating if the list of actions is ordered..
        /// </summary>
        [XmlAttribute("ordered")]
        public string Ordered
        {
            get
            {
                return this.orderedField;
            }

            set
            {
                this.orderedField = value;
            }
        }
    }
}